<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Event</title>
</head>
<body>
  <form id="form" action="#" method="get">
      <input type="text" name="username"/>
      <input type="submit" value="提交"/>
  </form>
  <script>
      document.getElementById("form").onsubmit =function (){
          //onsubmit 返回true，则表单会被提交，返回false，则表单不会被提交
          return true;
      }
  </script>
</body>
</html>